<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>1.基本列表</title>
<!--    点击按钮后, 页面没有变化但是vm.persons[0] 已经改变-->
    <!--  引入Vue  -->
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <!--  准备好一个容器  -->
    <div id="root">
        <h2>人员列表</h2>
        <button @click="updateMei">更新马冬梅的信息</button>
        <ul>
            <li v-for="p in persons" :key="p.id">
                {{p.name}}-{{p.age}}
            </li>

        </ul>
    </div>
</body>

<script type="text/javascript">
    const  vm = new Vue({
        el:'#root',
        data:{
            persons:[
                {id: '001', name: '马冬梅', age: 18, sex: '女'},
                {id: '002', name: '周冬雨', age: 17, sex: '女'},
                {id: '003', name: '周杰伦', age: 30, sex: '男'},
                {id: '004', name: '温兆伦', age:30, sex: '男'}
            ]
        },
        methods:{
            updateMei(){
                this.persons[0] = {id:'001',name:'why',age:18}
            }
        }
    })
</script>
</html>